var getRandomColor = function() {
return (function(a, b, c) {
return (c ? arguments.callee(a, b, c - 1) : '#') + b[a.floor(a.random() * 16)]
})(Math, '0123456789abcdef', 5)
};
var getColor=function()
{
	return "green";
}
function showPoly(a,b1,c1,d1) {
	//去掉点击某个点弹出东西
var b = new BMap.Map("allmap",{enableMapClick:false});
b.centerAndZoom(new BMap.Point(b1,c1), d1);
b.enableScrollWheelZoom(true);


a = JSON.parse(a);
var d = a[0].split(',');
for (c = 0; c < a.length; c++) {
var i = a[c].split(',');
var j = i[0];
var k = i[1];
a[c] = new BMap.Point(j, k)
};
for (c = 0; c < a.length; c++) {
var i = new BMap.Marker(a[c]);
b.addOverlay(i);
var j = "";
if (c == 0) {
j = '起点 '
} else if (c == (a.length - 1)) {
j = '终点 '
} else {
j = '经过点 '
};
var k = new BMap.Label(j + (c + 1), {
	//距离点的左右位置和上下位置
offset: new BMap.Size(-105, -115)
});
// var str = '<div style=background: url(../../static/img/tipBg.png);background-size: 100%;width: 330px;padding: 42px;color: #ffffff><img src=../../static/img/pic01.jpg alt= style=width: 100%;height: 100px;margin-bottom: 15px><p style=font-size: 18px;>${data.name} <span style=   color: #00DEFF;border: 1px solid #00DEFF;border-radius: 10px;padding: 0 5px;height: 24px;line-height: 22px;font-size: 14px;>火锅</span></p><p style= margin: 5px 0;font-size: 14px>地址：${data.address}</p><div style=display: inline-block;width: 50%;float: left;text-align: left;margin-top: 25px><img src=${this.getGrade(data.type)} alt= style=width: 100%></div> <ul style=display: inline-block;width: 50%;margin-top: 15px><li style=font-size: 12px;background: url(../../static/img/liBg.png) no-repeat;height: 55px;text-align: center;width: 112px> <p>浓度</p> <p><span style=font-size: 20px;color: #00DEFF;margin-right: 5px>3.2</span>mg/m3</p></li><li style=font-size: 12px;background: url(../../static/img/liBg.png) no-repeat;height: 55px;text-align: center;width: 112px>  <p>非甲烷总烃</p> <p><span style=font-size: 20px;color: #00DEFF;margin-right: 5px>14</span>mg/m3</p></li> <li style=font-size: 12px;background: url(../../static/img/liBg.png) no-repeat;height: 55px;text-align: center;width: 112px><p>油烟去除率</p> <p><span style=font-size: 20px;color: #00DEFF;margin-right: 5px>88.6</span>%</p></li></ul></div>';
//k.setContent("<div style='border:1px solid blue;width:100px;height:30px;'>xxxxxxxxx</div>");
//var str="<div style='width:273px;height:172px;background:url(http://www.crazyflasher.com/mercenaryempire/images/ingame.png);'>";
var str="<div class=\"msg\" id=\"msgContent"+c+"\">"+$("#msgContent").html()+"</div>";
k.setContent(str);
//k. setStyle({ color : "red", fontSize : "12px" }) ;
 k.setStyle({ 
        color: "#000", 
        border: "0px", 
        backgroundColor: "0.000000000001",  //通过这个方法，去掉背景色 
        fontSize: "12px",
        height: "20px",
        lineHeight: "20px"
    }); 
k.setTitle("标题");
k.addEventListener("click", function(){alert(this.getPosition().lng+","+this.getPosition().lat)});
i.setLabel(k)
};
var e = Math.floor(a.length / 11);
var f = a.length % 11;
var g = new BMap.DrivingRoute(b, {
onSearchComplete: function(i) {
if (g.getStatus() == BMAP_STATUS_SUCCESS) {
var j = g.getResults().getPlan(0);
var k = j.getNumRoutes();
for (var l = 0; l < k; l++) {
var m = j.getRoute(l).getPath();
var n = new BMap.Polyline(m);
var o = getColor();
n.setStrokeColor(o);
//线的粗细
n.setStrokeWeight(4);
b.addOverlay(n)
}
}
}
});
for (var h = 0; h < e; h++) {
var i = a.slice(h * 11 + 1, (h + 1) * 11);
g.search(a[h * 11], a[(h + 1) * 11 - 1], {
waypoints: i
})
};
if (f != 0) {
var i = a.slice(e * 11, a.length - 1);
g.search(a[e * 11], a[a.length - 1], {
waypoints: i
})
}
}